]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
magnifier: Clip all crosshair lines at even distances
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 6 Feb 2020 09:38:50 +0000 (10:38 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 7 Feb 2020 17:18:25 +0000 (18:18 +0100)
If the crosshair is clipped so it doesn't cover the pointer cursor,
the clip rectangle is skewed towards the bottom/right. This was
made so to accomodate the default pointer, but the unevenness stays
on other pointer cursors, and it makes the crosshair look odd on
short crosshair length.

Make all lines clip to an even distance from the center instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/984

js/ui/magnifier.js

index 8d2bf34a617d28b338e30490be98460fc68292a2..7250ce530b2a13367a7f4ac1954bf20a8c9ad29a 100644 (file)
@@ -1809,12 +1809,10 @@ class Crosshairs extends Clutter.Actor {
         let clipWidth = this._clipSize[0];
         let clipHeight = this._clipSize[1];
 
-        // Note that clip, if present, is not centred on the cross hair
-        // intersection, but biased towards the top left.
-        let left = groupWidth / 2 - clipWidth * 0.25 - leftLength;
-        let right = groupWidth / 2 + clipWidth * 0.75;
-        let top = groupHeight / 2 - clipHeight * 0.25 - topLength - thickness / 2;
-        let bottom = groupHeight / 2 + clipHeight * 0.75 + thickness / 2;
+        let left = groupWidth / 2 - clipWidth / 2 - leftLength - thickness / 2;
+        let right = groupWidth / 2 + clipWidth / 2 + thickness / 2;
+        let top = groupHeight / 2 - clipHeight / 2 - topLength - thickness / 2;
+        let bottom = groupHeight / 2 + clipHeight / 2 + thickness / 2;
         this._horizLeftHair.set_position(left, (groupHeight - thickness) / 2);
         this._horizRightHair.set_position(right, (groupHeight - thickness) / 2);
         this._vertTopHair.set_position((groupWidth - thickness) / 2, top);